﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ZK.YHP_TransManage
{
    public partial class 菱声文字转语音直接播放 : Form
    {
        public 菱声文字转语音直接播放()
        {
            InitializeComponent();
        }
        HardWareBLL.LS20BLL lS20BLL;

        private void button1_Click(object sender, EventArgs e)
        {

         

           
            //Models.LSwzzyybfM.playMusicReq mm = new Models.LSwzzyybfM.playMusicReq();
            //mm.type = "req";
            //mm.app = "ls20";
            //mm.op = "playMusic";
            //mm.params1.uid = "260973f2-f05e-4943-93ea-29a1c6d21cef";
            //mm.params1.name = "task1";
            //mm.params1.type = 5;
            //mm.params1.devices = new string[] { "ls20://02028718DAB9" };
            //mm.params1.level = 1000;
            //mm.params1.leng = "0";
            //mm.params1.count = 1;
            //mm.params1.vol = 25;
            //mm.params1.urls = new List<Models.LSwzzyybfM.fileUrl> { new Models.LSwzzyybfM.fileUrl { name = "name", uri = "http://192.168.1.188:10008/tts/f56a2536f4ed12d422357cb24bf04c8b_1607684371210358600.mp3" } };
            //Models.LSwzzyybfM.playMusicRes res = ZK.InterfaceServer.LSwzzyybfServer.playMusic(mm);
            //if (res.params1.result!= "0")
            //{
            //    MessageBox.Show("播放失败");
            //    return;
            //}
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Models.LSwzzyybfM.loginReq loginReq = new Models.LSwzzyybfM.loginReq();
            loginReq.type = "req";
            loginReq.app = "ls20";
            loginReq.op = "login";
            loginReq.params1.name = "admin";
            loginReq.params1.password = "admin";
            loginReq.params1.vender = "ls20";
            Models.LSwzzyybfM.loginRes loginRes = ZK.InterfaceServer.LSwzzyybfServer.login(loginReq);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Models.LSwzzyybfM.getAllDevicesReq mm = new Models.LSwzzyybfM.getAllDevicesReq();
            mm.type = "req";
            mm.app = "ls20";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
            mm.op = "getAllDevices";
            mm.params1.uid = "260973f2-f05e-4943-93ea-29a1c6d21cef";
            Models.LSwzzyybfM.getAllDevicesRes loginRes = ZK.InterfaceServer.LSwzzyybfServer.getAllDevices(mm);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                MessageBox.Show("字符串不能为空");
                return;
            }
            Models.LSwzzyybfM.tts_xf mm = new Models.LSwzzyybfM.tts_xf();
            mm.text = "有车辆上磅39.5千克，请刷卡。";
            mm.origin = "http://192.168.1.188:10008";
            mm.speed = "50";
            mm.voice_name = "xiaoyan";
            mm.volume = "100";
            Models.LSwzzyybfM.tts_xfRes res = ZK.InterfaceServer.LSwzzyybfServer.tts_xf(mm);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            lS20BLL = new HardWareBLL.LS20BLL(new Models.TerminalM() { ip = textBoxfwq.Text.Trim()},new Models.TerminalM() { ip = textBoxyz.Text.Trim()});
            Common.ShowBlackBox.WriteLine("1 音响初始化成功");
        }

        private void button6_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxstr.Text.Trim()))
            {
                MessageBox.Show("文字不能为空");
                return;
            }
            Common.ShowBlackBox.WriteLine("2 "+ lS20BLL.SendMessage(msg: textBoxstr.Text.Trim(), vol: Convert.ToInt32(textBox2.Text.Trim())).msg);
        }
    }
}
